home *** CD-ROM | disk | FTP | other *** search
- /*
- * Plurals
- *
- * Author: S.C.Merrall
- *
- * File: MP_Context.h
- *
- * Contents:
- *
- * Description: Plurals, a new class are identified by a set of
- * processors and a pointers to objects within those
- * processors. The set of processors is described by
- * the context of a plural which is shared between
- * conformant plurals.
- *
- * Change History:
- *
- * Date Name Comment
- * -------- ---- -------
- * 28:06:91 SCM Created - hacked from MP_Plural.m
- * 08:04:92 SCM Modifications to allow garbage collection - handles are
- * chained and the free flag is used by the system!
- *
- */
-
- /* Include Files */
- /* ======= ===== */
-
- #include <mpl.h>
- /* #include "proc_pair.h"
- * #include "seq_net.h"
- */
-
- #include "constant.h"
-
- #include <stdio.h>
- #include "mp_object.h"
- #include "mp_debug_off.h"
-
- /* Global Variables */
-
- object MPC_chain; /* Head of chain of MasPar Context objects */
-
- /* External Functions */
- /* ======== ========= */
-
- #ifdef __STDC__
-
- extern free_plural( object );
-
- #else
-
- extern int free_plural();
-
- #endif
-
-
- /* Object Handling Code */
- /* ====== ======== ==== */
-
- /*----------------------------------------------------------------------------*
- * Function : MPC_free
- *
- * Parameters : object MPC_to_be_freed: The MP_Context object to be freed
- *
- * Description: Free's an MP_Context object.
- *
- * Result : int: SUCCESS
- *---------------------------------------------------------------------------*/
-
- #ifdef __STDC__
-
- int MPC_free( object MPC_to_be_freed )
-
- #else
-
- int MPC_free( MPC_to_be_freed )
-
- object MPC_to_be_freed;
-
- #endif
-
- {
-
- DBG_CALL("MPC_free");
- DBG_ARGS(fprintf(dbg,"MPP_to_be_freed=%lx",MPC_to_be_freed));
-
- OF_free(MPC_to_be_freed);
- free((char *) MPC_to_be_freed);
-
- DBG_EXIT(fprintf(dbg,"SUCCESS"));
- return SUCCESS;
- }
-
- /*----------------------------------------------------------------------------*
- * Function : MPC_make
- *
- * Parameters : none
- *
- * Description: This function creates a handle for a plural Context object
- * The information in the object identifies whic set of processors
- * should be active, it contains the offset of the head of the
- * context stack so the active set can be further modified by
- * mp-if etc ..., the objects are chained in a list for GC
- * reasons.
- *
- * Result : object: The new MP_Context object
- *---------------------------------------------------------------------------*/
-
- #ifdef __STDC__
-
- object MPC_make( int width, int height )
-
- #else
-
- object MPC_make( width, height )
-
- int width;
- int height;
-
- #endif
-
- {
- object MPC_new;
-
- DBG_CALL("MPC_make");
- DBG_ARGS(fprintf(dbg,"width=%d,height=%d",width,height));
-
- MPC_new = OF_make(OC_MP_Context); /* Allocate generic Lisplural object */
-
- OA_width(MPC_new) = (natural) width;
- OA_height(MPC_new) = (natural) height;
-
- if (alloc_plural(MPC_new) == FAIL) {
-
- DBG_FAIL(fprintf(dbg,"FAIL: Unable to allocate plural space"));
- OF_destroy(MPC_new);
- return FAIL;
- }
-
- OA_next(MPC_new) = MPC_chain; /* chain */
- MPC_chain = MPC_new;
-
- DBG_EXIT(fprintf(dbg,"%lx",MPC_new));
- return MPC_new;
- }
-
- struct MP_Context OC_MP_Context = {OI_MP_Context,
- MPC_free,
- MPC_make,
- 0, 0, 0, 0, 0, 0};
-
-
-